import { defineConfig } from "vite";
import AutoImport from "unplugin-auto-import/vite";
import { resolve } from "path";
import uni from "@dcloudio/vite-plugin-uni";
import ENV_CONFIG from "./env/index";

// https://vitejs.dev/config/
export default defineConfig({
	resolve: {
		// 配置路径别名
		alias: {
			"@": resolve(__dirname, "./src")
		}
	},
	plugins: [
		uni(),
		AutoImport({
			// 安装两行后你会发现在组件中不用再导入ref，reactive等
			imports: ["vue", "pinia", "uni-app"],
			// 存放的位置
			dts: "src/types/auto-import.d.ts",
			eslintrc: {
				enabled: true, // Default `false`
				filepath: "./.eslintrc-auto-import.json", // 生成eslint自动导入的文件 `./.eslintrc-auto-import.json`
				globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
			}
		})
	],
	define: {
		"process.env.config": ENV_CONFIG
	}
});
